import { Link, useLocale, useSiteData, useLocation } from 'dumi';
import React, { type FC } from 'react';
import './index.less';
import * as utils from '../../utils';

const Logo: FC = () => {
  const { themeConfig } = useSiteData();

  const lang =
    (window.localStorage && localStorage.getItem('locale')) === 'zh-CN'
      ? 'zh-CN'
      : 'en-US';
  return (
    <Link
      className="dumi-default-logo"
      to={lang === 'zh-CN' ? '/' : '/index-en'}
    >
      {themeConfig.logo !== false && (
        <img
          src={
            themeConfig.logo ||
            ''
          }
          alt={themeConfig.name}
        />
      )}
      {themeConfig.name}
    </Link>
  );
};

export default Logo;
